home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9110.ZIP / STRING.ZIP / STRIEQ.CPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  703b  |  30 lines

  1. #include <string.h>
  2. #include <ctype.h>
  3. #include <errno.h>
  4. #include <string.hpp>
  5.  
  6. int operator==(const String &a, const String &b)
  7. {
  8.     if (a.rp == b.rp) return 1;
  9.     register int al = a.length();
  10.     register int bl = b.length();
  11.     if (al != bl) return 0;
  12.     return !memcmp(a.body(), b.body(), al);
  13. }
  14.  
  15. int operator==(const String &a, const char *s)
  16. {
  17.     register int al = a.length();
  18.     register int bl = strlen(s);
  19.     if (al != bl) return 0;
  20.     return !memcmp(a.body(), s, al);
  21. }
  22.  
  23. int operator==(const char *s, const String &a)
  24. {
  25.     register int al = a.length();
  26.     register int bl = strlen(s);
  27.     if (al != bl) return 0;
  28.     return !memcmp(s, a.body(), al);
  29. }
  30.